﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void BtnOk_Click(object sender, EventArgs e)
    {
        if (this.TextBox1.Text == "")
        {
            Response.Write("<script language=javascript>alert('对不起！文本框中的内容不能为空！');location='javascript:history.go(-1)'</script>");
        }
        else
        { 
          //使用Replace替换字符串
          String StrOld = this.LblOldStr.Text;
          StringBuilder StrNew = new StringBuilder(StrOld);
          String str2 = this.TextBox1.Text;
          //StrNew = StrNew.Replace(StrOld[1].ToString(), str2);
          StrNew = StrNew.Replace(StrOld, str2);
          this.LblStrNew.Text = StrNew.ToString();
        }
       
    }
}
